<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Adminox - Responsive Web App Kit</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
        <meta content="Coderthemes" name="author" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

        <!-- App favicon -->
        <link rel="shortcut icon" href="/static/assets/images/favicon.ico">

        <!-- Custom box css -->
        <link href="/static/plugins/custombox/css/custombox.min.css" rel="stylesheet">
        <link href="/static/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">

        {block name="css"}{/block}

        <!-- App css -->
        <link href="/static/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="/static/assets/css/icons.css" rel="stylesheet" type="text/css" />
        <link href="/static/assets/css/metismenu.min.css" rel="stylesheet" type="text/css" />
        <link href="/static/assets/css/style.css" rel="stylesheet" type="text/css" />

        <script src="/static/assets/js/modernizr.min.js"></script>

    </head>


    <body>

        <!-- Begin page -->
        <div id="wrapper">

            <!-- Top Bar Start -->
            <div class="topbar">

                <!-- LOGO -->
                <div class="topbar-left">
                    <a href="index.html" class="logo" style="color:#fff !important;">
                                DEMO
                    </a>
                </div>

                <nav class="navbar-custom">

                    <ul class="list-inline float-right mb-0">
                        <li class="list-inline-item dropdown notification-list" style="display: none;">
                            <a class="nav-link dropdown-toggle arrow-none waves-light waves-effect" data-toggle="dropdown" href="#" role="button"
                               aria-haspopup="false" aria-expanded="false">
                                <i class="dripicons-bell noti-icon"></i>
                                <span class="badge badge-pink noti-icon-badge">4</span>
                            </a>
                            <div class="dropdown-menu dropdown-menu-right dropdown-arrow dropdown-lg" aria-labelledby="Preview">
                                <!-- item-->
                                <div class="dropdown-item noti-title">
                                    <h5><span class="badge badge-danger float-right">5</span>Notification</h5>
                                </div>

                                <!-- item-->
                                <a href="javascript:void(0);" class="dropdown-item notify-item">
                                    <div class="notify-icon bg-success"><i class="icon-bubble"></i></div>
                                    <p class="notify-details">Robert S. Taylor commented on Admin<small class="text-muted">1 min ago</small></p>
                                </a>

                                <!-- item-->
                                <a href="javascript:void(0);" class="dropdown-item notify-item">
                                    <div class="notify-icon bg-info"><i class="icon-user"></i></div>
                                    <p class="notify-details">New user registered.<small class="text-muted">1 min ago</small></p>
                                </a>

                                <!-- item-->
                                <a href="javascript:void(0);" class="dropdown-item notify-item">
                                    <div class="notify-icon bg-danger"><i class="icon-like"></i></div>
                                    <p class="notify-details">Carlos Crouch liked <b>Admin</b><small class="text-muted">1 min ago</small></p>
                                </a>

                                <!-- All-->
                                <a href="javascript:void(0);" class="dropdown-item notify-item notify-all">
                                    View All
                                </a>

                            </div>
                        </li>

                        <li class="list-inline-item dropdown notification-list">
                            <a class="nav-link dropdown-toggle waves-effect waves-light nav-user" data-toggle="dropdown" href="#" role="button"
                               aria-haspopup="false" aria-expanded="false">
                               <div class="login-user-img">{:session('userInfo.username') }</div>
                            </a>
                            <div class="dropdown-menu dropdown-menu-right profile-dropdown " aria-labelledby="Preview">
                                <!-- item-->
                                <div class="dropdown-item noti-title">
                                    <h5 class="text-overflow"><small>欢迎您 {:session('userInfo.nickname') ? session('userInfo.nickname') : session('userInfo.username')}</small> </h5>
                                </div>

                                <!-- item-->
                                <a href="#change-password-modal" class="dropdown-item notify-item" data-animation="fadein" data-plugin="custommodal"
                                       data-overlaySpeed="200" data-overlayColor="#36404a" id="change-per-pwd-btn">
                                    <i class="zmdi zmdi-settings"></i> <span>修改密码</span>
                                </a>
              
                                <!-- item-->
                                <a href="javascript:void(0);" class="dropdown-item notify-item" data-url="{:url('SysUser/logout')}" id="logout-btn">
                                    <i class="zmdi zmdi-power"></i> <span>退出登录</span>
                                </a>

                            </div>
                        </li>

                    </ul>

                </nav>

            </div>
            <!-- Top Bar End -->


            <!-- ========== Left Sidebar Start ========== -->
            <div class="left side-menu">
                <div class="slimscroll-menu" id="remove-scroll">
                    {php}
                        $ca = request()->controller()."/".request()->action();
                    {/php}
                    <!--- Sidemenu -->
                    <div id="sidebar-menu">
                        <!-- Left Menu Start -->
                        <ul class="metismenu" id="side-menu">
                            <li class="{:request()->controller() == 'Dashboard' && request()->action() == 'index' ? 'active' : ''}">
                                <a href="{:url('Dashboard/index')}" class="{:request()->controller() == 'Dashboard' && request()->action() == 'index' ? 'active' : ''}"><i class="fi-air-play"></i> <span> 首页 </span></a>
                            </li>
                            {foreach :session('menuList') as $menu}
                            {php}
                                $sonMenuPerms = arrayColumn(flattenMenuArray($menu['children']), 'perms');
                            {/php}
                            <li class="{:in_array($ca, $sonMenuPerms) ? 'active' : ''}">
                                <a href="javascript: void(0);" class="{:in_array($ca, $sonMenuPerms) ? 'active' : ''}">
                                    <i class="fa {$menu.icon}"></i> {$menu.menu_name}</span>
                                </a>
                                {if $menu.children}
                                <ul class="nav-second-level">
                                    {foreach $menu.children as $sonMenu}
                                    <li class="{$ca == $sonMenu.perms ? 'active' : ''}"><a href="{:url($sonMenu.perms)}" class="{$ca == $sonMenu.perms ? 'active' : ''}">{$sonMenu.menu_name}</a></li>
                                    {/foreach}
                                </ul>
                                {/if}
                            </li>
                            {/foreach}
                        </ul>

                    </div>
                    <!-- Sidebar -->
                    <div class="clearfix"></div>

                </div>
                <!-- Sidebar -left -->

            </div>
            <!-- Left Sidebar End -->



            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
            <div class="content-page">
                <!-- Start content -->
                <div class="content" style="padding-top:20px">
                    {block name="content"}{/block}
                </div> <!-- content -->

                <footer class="footer text-right">
                    2024 © Nextera
                </footer>

            </div>


            <!-- ============================================================== -->
            <!-- End Right content here -->
            <!-- ============================================================== -->


        </div>
        <!-- END wrapper -->

        <!-- Modal -->
        <div id="change-password-modal" class="modal-demo">
            <button type="button" class="close" onclick="Custombox.close();">
                <span>&times;</span><span class="sr-only">Close</span>
            </button>
            <h4 class="custom-modal-title">修改密码</h4>
            <div class="custom-modal-text">
                <form class="change-password-form" action="{:url('SysUser/changePassword')}" method="post">
                    <div class="form-group">
                        <label for="pass1">密码<span class="text-danger">*</span></label>
                        <input id="pass1" type="password" name="password" placeholder="请输入密码" required
                            class="form-control">
                    </div>

                    <div class="form-group">
                        <label for="pass1">确认密码<span class="text-danger">*</span></label>
                        <input id="pass1" type="password" name="repassword" placeholder="请再次输入密码" required
                            class="form-control">
                    </div>

                    <div class="form-group text-center m-b-0">
                        <input type="hidden" name="id" >
                        <button class="btn btn-custom waves-effect waves-light" type="submit">确定</button>
                    </div>

                </form>
            </div>
        </div>



        <!-- jQuery  -->
        <script src="/static/assets/js/jquery.min.js"></script>
        <script src="/static/assets/js/tether.min.js"></script><!-- Tether for Bootstrap -->
        <script src="/static/assets/js/bootstrap.min.js"></script>
        <script src="/static/assets/js/metisMenu.min.js"></script>
        <script src="/static/assets/js/waves.js"></script>
        <script src="/static/assets/js/jquery.slimscroll.js"></script>

        <!-- Modal-Effect -->
        <script src="/static/plugins/custombox/js/custombox.min.js"></script>
        <script src="/static/plugins/custombox/js/legacy.min.js"></script>

        <!-- plugin js -->
        <!-- <script src="/static/plugins/timepicker/bootstrap-timepicker.js"></script> -->
        <script src="/static/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
        <script src="/static/assets/pages/bootstrap-datepicker.zh-CN.min.js"></script>
        <script src="/static/assets/pages/jquery.form-pickers.init.js"></script>

        <!-- App js -->
        <script src="/static/assets/js/jquery.core.js"></script>
        <script src="/static/assets/js/jquery.app.js"></script>


        <script src="/static/layer/layer.js"></script>

        {block name="script"}{/block}
        
        <script src="/static/js/base.js"></script>

        <script>
            $(document).on('click', '#change-per-pwd-btn', function() {
                $('.change-password-form').find('input').val('');
            })
            // 提交表单
            $(document).on('submit', '.change-password-form', function(event) { 
                // 阻止表单的默认提交行为   
                event.preventDefault(); 
            
                $.post($(this).attr('action'), $(this).serialize(), function(response) {  
                    layer.msg(response.msg);
                    if (response.code == 200) {
                        Custombox.close();
                    }
                }).fail(function(jqXHR, textStatus, errorThrown) {  
                    layer.msg("Request failed") 
                });  
            })

            // 退出登录
            $(document).on('click', '#logout-btn', function() {
                $.get($(this).data('url'), function(response) { 
                    layer.msg(response.msg) 
                    if (response.code == 200) {
                        setTimeout(function() { window.location.href = "{:url('PublicController/login')}"; }, 1000);
                    } 
                }).fail(function(jqXHR, textStatus, errorThrown) {  
                    layer.msg("Request failed") 
                });
            })
        </script>
    </body>
</html>